# 导包
import jsonschema

# 创建校验规则
schema = {
    "type":"object",
    "properties":{
        "success":{
            "type":"boolean"
        },
        "code":{
            "type": "integer"
        },
        "message":{
            "type": "string"
        }
    },
    "required":["success","code","message"]
}

# 准备校验数据
data  = {
    "success":True,
    "code":10000,
    "message":"操作成功"
}
# 调用validate 方法 实现校验
result = jsonschema.validate(instance=data,schema=schema)
print(f"result={result}")

# None 代表通过
# ValidationError: '10000' is not of type 'integer'
# SchemaError:检验规则 语法有误